package com.pks.insurance.helper;

import java.util.List;

import org.apache.log4j.Logger;

import com.pks.insurance.dao.CustomerDAO;
import com.pks.insurance.dao.impl.CustomerDAOImpl;
import com.pks.insurance.dto.CustomerDto;

/**
 * Perform Administrator retated functions.
 * 
 * @author Pankaj Soni
 * 
 */
public class AdminHelper {

	private static final Logger LOGGER = Logger.getLogger(AdminHelper.class);

	/**
	 * Retrive users
	 * 
	 * @return list
	 */
	public List<CustomerDto> getUsersList() {
		LOGGER.debug("begin");
		CustomerDAO customerDAO = new CustomerDAOImpl();
		List<CustomerDto> usersList = customerDAO.findCustomers();
		LOGGER.info(usersList);
		return usersList;
	}

	/**
	 * Retrives users list to the admin matching with criteria.
	 * 
	 * @param ssn
	 * @return List<RegistrationDto>
	 */
	public List<CustomerDto> getUsersList(String ssn) {
		LOGGER.debug("begin");
		CustomerDAO customerDAO = new CustomerDAOImpl();
		List<CustomerDto> usersList = customerDAO.findCustomers(ssn);
		LOGGER.info(usersList);
		return usersList;
	}

	/**
	 * Deletes the user.
	 * 
	 * @param ssn
	 */
	public void deleteUser(String ssn) {
		LOGGER.debug("begin");
		CustomerDAO customerDAO = new CustomerDAOImpl();
		customerDAO.deleteCustomer(ssn);
	}

}
